package gateway.auth

class OAuthClientDetails implements Serializable {

    String clientId
    String resourceIds
    String clientSecret
    String scope = "read,write"
    String authorizedGrantTypes = "authorization_code,password,refresh_token,client_credentials"
    String webServerRedirectUri
    String authorities
    Integer accessTokenValidity
    Integer refreshTokenValidity
    String additionalInformation
    String autoapprove

    static constraints = {
        clientId(blank: false)
        resourceIds(nullable: true)
        clientSecret(blank: false)
        scope(blank: false)
        authorizedGrantTypes(blank: false)
        webServerRedirectUri(nullable: true)
        authorities(nullable: true)
        accessTokenValidity(nullable: true)
        refreshTokenValidity(nullable: true)
        additionalInformation(nullable: true)
        autoapprove(nullable: true)
    }

    static mapping = {
        datasource 'spring_security_oauth2'
        id composite: ['clientId', 'resourceIds']
        version false
    }
}
